.TH "libnet-functions.h" 3 "10 Mar 2004" "libnet" \" -*- nroff -*-
.ad l
.nh
.SH NAME
libnet-functions.h \- libnet exported function prototypes  

.SH SYNOPSIS
.br
.PP
.SS "Functions"

.in +1c
.ti -1c
.RI "libnet_t * \fBlibnet_init\fP (int injection_type, char *device, char *err_buf)"
.br
.ti -1c
.RI "void \fBlibnet_destroy\fP (libnet_t *l)"
.br
.ti -1c
.RI "void \fBlibnet_clear_packet\fP (libnet_t *l)"
.br
.ti -1c
.RI "void \fBlibnet_stats\fP (libnet_t *l, struct libnet_stats *ls)"
.br
.ti -1c
.RI "int \fBlibnet_getfd\fP (libnet_t *l)"
.br
.ti -1c
.RI "int8_t * \fBlibnet_getdevice\fP (libnet_t *l)"
.br
.ti -1c
.RI "u_int8_t * \fBlibnet_getpbuf\fP (libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "u_int32_t \fBlibnet_getpbuf_size\fP (libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "char * \fBlibnet_geterror\fP (libnet_t *l)"
.br
.ti -1c
.RI "u_int32_t \fBlibnet_getpacket_size\fP (libnet_t *l)"
.br
.ti -1c
.RI "int \fBlibnet_seed_prand\fP (libnet_t *l)"
.br
.ti -1c
.RI "u_int32_t \fBlibnet_get_prand\fP (int mod)"
.br
.ti -1c
.RI "int \fBlibnet_toggle_checksum\fP (libnet_t *l, libnet_ptag_t ptag, int mode)"
.br
.ti -1c
.RI "char * \fBlibnet_addr2name4\fP (u_int32_t in, u_int8_t use_name)"
.br
.ti -1c
.RI "u_int32_t \fBlibnet_name2addr4\fP (libnet_t *l, char *host_name, u_int8_t use_name)"
.br
.ti -1c
.RI "libnet_in6_addr \fBlibnet_name2addr6\fP (libnet_t *l, char *host_name, u_int8_t use_name)"
.br
.ti -1c
.RI "void \fBlibnet_addr2name6_r\fP (struct libnet_in6_addr addr, u_int8_t use_name, char *host_name, int host_name_len)"
.br
.ti -1c
.RI "int \fBlibnet_plist_chain_new\fP (libnet_t *l, libnet_plist_t **plist, char *token_list)"
.br
.ti -1c
.RI "int \fBlibnet_plist_chain_next_pair\fP (libnet_plist_t *plist, u_int16_t *bport, u_int16_t *eport)"
.br
.ti -1c
.RI "int \fBlibnet_plist_chain_dump\fP (libnet_plist_t *plist)"
.br
.ti -1c
.RI "char * \fBlibnet_plist_chain_dump_string\fP (libnet_plist_t *plist)"
.br
.ti -1c
.RI "int \fBlibnet_plist_chain_free\fP (libnet_plist_t *plist)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_802_1q\fP (u_int8_t *dst, u_int8_t *src, u_int16_t tpi, u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_802_1x\fP (u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_802_2\fP (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_802_2snap\fP (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_802_3\fP (u_int8_t *dst, u_int8_t *src, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ethernet\fP (u_int8_t *dst, u_int8_t *src, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_autobuild_ethernet\fP (u_int8_t *dst, u_int16_t type, libnet_t *l)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_fddi\fP (u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_autobuild_fddi\fP (u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, libnet_t *l)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_arp\fP (u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_autobuild_arp\fP (u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, libnet_t *l)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_tcp\fP (u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_tcp_options\fP (u_int8_t *options, u_int32_t options_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_udp\fP (u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_cdp\fP (u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, u_int16_t len, u_int8_t *value, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_icmpv4_echo\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_icmpv4_mask\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_icmpv4_unreach\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_icmpv4_redirect\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t gateway, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_icmpv4_timeexceed\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_icmpv4_timestamp\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_igmp\fP (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipv4\fP (u_int16_t len, u_int8_t tos, u_int16_t id, u_int16_t frag, u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipv4_options\fP (u_int8_t *options, u_int32_t options_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_autobuild_ipv4\fP (u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t *l)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipv6\fP (u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipv6_frag\fP (u_int8_t nh, u_int8_t reserved, u_int16_t frag, u_int32_t id, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipv6_routing\fP (u_int8_t nh, u_int8_t len, u_int8_t rtype, u_int8_t segments, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipv6_destopts\fP (u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipv6_hbhopts\fP (u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_autobuild_ipv6\fP (u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst, libnet_t *l)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_isl\fP (u_int8_t *dhost, u_int8_t type, u_int8_t user, u_int8_t *shost, u_int16_t len, u_int8_t *snap, u_int16_t vid, u_int16_t index, u_int16_t reserved, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipsec_esp_hdr\fP (u_int32_t spi, u_int32_t seq, u_int32_t iv, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipsec_esp_ftr\fP (u_int8_t len, u_int8_t nh, int8_t *auth, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ipsec_ah\fP (u_int8_t nh, u_int8_t len, u_int16_t res, u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_dnsv4\fP (u_int16_t h_len, u_int16_t id, u_int16_t flags, u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, u_int16_t num_addi_rr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_rip\fP (u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, u_int32_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_rpc_call\fP (u_int32_t rm, u_int32_t xid, u_int32_t prog_num, u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, u_int8_t *cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t *vdata, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_stp_conf\fP (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t flags, u_int8_t *root_id, u_int32_t root_pc, u_int8_t *bridge_id, u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, u_int16_t hello_time, u_int16_t f_delay, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_stp_tcn\fP (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_token_ring\fP (u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_autobuild_token_ring\fP (u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, libnet_t *l)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_vrrp\fP (u_int8_t version, u_int8_t type, u_int8_t vrouter_id, u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_mpls\fP (u_int32_t label, u_int8_t experimental, u_int8_t bos, u_int8_t ttl, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ntp\fP (u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2\fP (u_int16_t len, u_int8_t type, u_int32_t rtr_id, u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_hello\fP (u_int32_t netmask, u_int16_t interval, u_int8_t opts, u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, u_int32_t neighbor, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_dbd\fP (u_int16_t dgram_len, u_int8_t opts, u_int8_t type, u_int seqnum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsr\fP (u_int type, u_int lsid, u_int32_t advrtr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsu\fP (u_int num, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa\fP (u_int16_t age, u_int8_t opts, u_int8_t type, u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_rtr\fP (u_int16_t flags, u_int16_t num, u_int id, u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_net\fP (u_int32_t nmask, u_int rtrid, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_sum\fP (u_int32_t nmask, u_int metric, u_int tos, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_as\fP (u_int32_t nmask, u_int metric, u_int32_t fwdaddr, u_int tag, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_data\fP (u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_dhcpv4\fP (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_bootpv4\fP (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "u_int32_t \fBlibnet_getgre_length\fP (u_int16_t fv)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_gre\fP (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_egre\fP (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_gre_sre\fP (u_int16_t af, u_int8_t offset, u_int8_t length, u_int8_t *routing, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_gre_last_sre\fP (libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_bgp4_header\fP (u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], u_int16_t len, u_int8_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_bgp4_open\fP (u_int8_t version, u_int16_t src_as, u_int16_t hold_time, u_int32_t bgp_id, u_int8_t opt_len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_bgp4_update\fP (u_int16_t unfeasible_rt_len, u_int8_t *withdrawn_rt, u_int16_t total_path_attr_len, u_int8_t *path_attributes, u_int16_t info_len, u_int8_t *reachability_info, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_bgp4_notification\fP (u_int8_t err_code, u_int8_t err_subcode, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_sebek\fP (u_int32_t magic, u_int16_t version, u_int16_t type, u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_link\fP (u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_autobuild_link\fP (u_int8_t *dst, u_int8_t *oui, u_int16_t type, libnet_t *l)"
.br
.ti -1c
.RI "int \fBlibnet_write\fP (libnet_t *l)"
.br
.ti -1c
.RI "u_int32_t \fBlibnet_get_ipaddr4\fP (libnet_t *l)"
.br
.ti -1c
.RI "libnet_in6_addr \fBlibnet_get_ipaddr6\fP (libnet_t *l)"
.br
.ti -1c
.RI "libnet_ether_addr * \fBlibnet_get_hwaddr\fP (libnet_t *l)"
.br
.ti -1c
.RI "u_int8_t * \fBlibnet_hex_aton\fP (int8_t *s, int *len)"
.br
.ti -1c
.RI "int \fBlibnet_adv_cull_packet\fP (libnet_t *l, u_int8_t **packet, u_int32_t *packet_s)"
.br
.ti -1c
.RI "int \fBlibnet_adv_cull_header\fP (libnet_t *l, libnet_ptag_t ptag, u_int8_t **header, u_int32_t *header_s)"
.br
.ti -1c
.RI "int \fBlibnet_adv_write_link\fP (libnet_t *l, u_int8_t *packet, u_int32_t packet_s)"
.br
.ti -1c
.RI "void \fBlibnet_adv_free_packet\fP (libnet_t *l, u_int8_t *packet)"
.br
.ti -1c
.RI "int \fBlibnet_cq_add\fP (libnet_t *l, char *label)"
.br
.ti -1c
.RI "libnet_t * \fBlibnet_cq_remove\fP (libnet_t *l)"
.br
.ti -1c
.RI "libnet_t * \fBlibnet_cq_remove_by_label\fP (char *label)"
.br
.ti -1c
.RI "int8_t * \fBlibnet_cq_getlabel\fP (libnet_t *l)"
.br
.ti -1c
.RI "libnet_t * \fBlibnet_cq_find_by_label\fP (char *label)"
.br
.ti -1c
.RI "void \fBlibnet_cq_destroy\fP ()"
.br
.ti -1c
.RI "libnet_t * \fBlibnet_cq_head\fP ()"
.br
.ti -1c
.RI "int \fBlibnet_cq_last\fP ()"
.br
.ti -1c
.RI "libnet_t * \fBlibnet_cq_next\fP ()"
.br
.ti -1c
.RI "u_int32_t \fBlibnet_cq_size\fP ()"
.br
.ti -1c
.RI "void \fBlibnet_diag_dump_context\fP (libnet_t *l)"
.br
.ti -1c
.RI "void \fBlibnet_diag_dump_pblock\fP (libnet_t *l)"
.br
.ti -1c
.RI "char * \fBlibnet_diag_dump_pblock_type\fP (u_int8_t type)"
.br
.ti -1c
.RI "void \fBlibnet_diag_dump_hex\fP (u_int8_t *packet, u_int32_t len, int swap, FILE *stream)"
.br
.ti -1c
.RI "int \fBlibnet_write_raw_ipv4\fP (libnet_t *l, u_int8_t *packet, u_int32_t size)"
.br
.ti -1c
.RI "int \fBlibnet_write_raw_ipv6\fP (libnet_t *l, u_int8_t *packet, u_int32_t size)"
.br
.ti -1c
.RI "int \fBlibnet_write_link\fP (libnet_t *l, u_int8_t *packet, u_int32_t size)"
.br
.ti -1c
.RI "int \fBlibnet_open_raw4\fP (libnet_t *l)"
.br
.ti -1c
.RI "int \fBlibnet_close_raw4\fP (libnet_t *l)"
.br
.ti -1c
.RI "int \fBlibnet_open_raw6\fP (libnet_t *l)"
.br
.ti -1c
.RI "int \fBlibnet_close_raw6\fP (libnet_t *l)"
.br
.ti -1c
.RI "int \fBlibnet_select_device\fP (libnet_t *l)"
.br
.ti -1c
.RI "int \fBlibnet_open_link\fP (libnet_t *l)"
.br
.ti -1c
.RI "int \fBlibnet_close_link\fP (libnet_t *l)"
.br
.ti -1c
.RI "int \fBlibnet_do_checksum\fP (libnet_t *l, u_int8_t *packet, int protocol, int len)"
.br
.ti -1c
.RI "u_int32_t \fBlibnet_compute_crc\fP (u_int8_t *buf, u_int32_t len)"
.br
.ti -1c
.RI "u_int16_t \fBlibnet_ip_check\fP (u_int16_t *addr, int len)"
.br
.ti -1c
.RI "int \fBlibnet_in_cksum\fP (u_int16_t *addr, int len)"
.br
.ti -1c
.RI "libnet_pblock_t * \fBlibnet_pblock_probe\fP (libnet_t *l, libnet_ptag_t ptag, u_int32_t n, u_int8_t type)"
.br
.ti -1c
.RI "libnet_pblock_t * \fBlibnet_pblock_new\fP (libnet_t *l, u_int32_t size)"
.br
.ti -1c
.RI "int \fBlibnet_pblock_swap\fP (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)"
.br
.ti -1c
.RI "int \fBlibnet_pblock_insert_before\fP (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)"
.br
.ti -1c
.RI "void \fBlibnet_pblock_delete\fP (libnet_t *l, libnet_pblock_t *p)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_pblock_update\fP (libnet_t *l, libnet_pblock_t *p, u_int32_t h, u_int8_t type)"
.br
.ti -1c
.RI "libnet_pblock_t * \fBlibnet_pblock_find\fP (libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "int \fBlibnet_pblock_append\fP (libnet_t *l, libnet_pblock_t *p, u_int8_t *buf, u_int32_t len)"
.br
.ti -1c
.RI "void \fBlibnet_pblock_setflags\fP (libnet_pblock_t *p, u_int8_t flags)"
.br
.ti -1c
.RI "int \fBlibnet_pblock_p2p\fP (u_int8_t type)"
.br
.ti -1c
.RI "int \fBlibnet_pblock_coalesce\fP (libnet_t *l, u_int8_t **packet, u_int32_t *size)"
.br
.ti -1c
.RI "int \fBlibnet_check_iface\fP (libnet_t *l)"
.br
.in -1c
.SS "Variables"

.in +1c
.ti -1c
.RI "const  struct libnet_in6_addr \fBin6addr_error\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
libnet exported function prototypes 


.SH "Function Documentation"
.PP 
.SS "char* libnet_addr2name4 (u_int32_t in, u_int8_t use_name)"
.PP
Takes a network byte ordered IPv4 address and returns a pointer to either a canonical DNS name (if it has one) or a string of dotted decimals. This may incur a DNS lookup if the hostname and mode is set to LIBNET_RESOLVE. If mode is set to LIBNET_DONT_RESOLVE, no DNS lookup will be performed and the function will return a pointer to a dotted decimal string. The function cannot fail -- if no canonical name exists, it will fall back on returning a dotted decimal string. This function is non-reentrant. 
.PP
\fBParameters:\fP
.RS 4
\fIin\fP network byte ordered IPv4 address 
.br
\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE 
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to presentation format string 
.RE
.PP

.SS "void libnet_addr2name6_r (struct libnet_in6_addr addr, u_int8_t use_name, char * host_name, int host_name_len)"
.PP
Should document this baby right here. 
.SS "int libnet_adv_cull_header (libnet_t * l, libnet_ptag_t ptag, u_int8_t ** header, u_int32_t * header_s)"
.PP
[Advanced Interface] Pulls the header from the specified ptag from the given libnet context. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP the ptag referencing the header to pull 
.br
\fIheader\fP will contain the header 
.br
\fIheader_s\fP will contain the header size 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, -1 on failure 
.RE
.PP

.SS "int libnet_adv_cull_packet (libnet_t * l, u_int8_t ** packet, u_int32_t * packet_s)"
.PP
[Advanced Interface] Yanks a prebuilt, wire-ready packet from the given libnet context. If libnet was configured to do so (which it is by default) the packet will have all checksums written in. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. It is important to note that the function performs an implicit malloc() and a corresponding call to \fBlibnet_adv_free_packet()\fP should be made to free the memory packet occupies. If the function fails \fBlibnet_geterror()\fP can tell you why. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIpacket\fP will contain the wire-ready packet 
.br
\fIpacket_s\fP will contain the packet size 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, -1 on failure 
.RE
.PP

.SS "void libnet_adv_free_packet (libnet_t * l, u_int8_t * packet)"
.PP
[Advanced Interface] Frees the memory allocated when \fBlibnet_adv_cull_packet()\fP is called. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIpacket\fP a pointer to the packet to free 
.RE
.PP

.SS "int libnet_adv_write_link (libnet_t * l, u_int8_t * packet, u_int32_t packet_s)"
.PP
[Advanced Interface] Writes a packet the network at the link layer. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to \fBlibnet_adv_cull_packet()\fP. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIpacket\fP a pointer to the packet to inject 
.br
\fIpacket_s\fP the size of the packet 
.RE
.PP
\fBReturns:\fP
.RS 4
the number of bytes written, or -1 on failure 
.RE
.PP

.SS "libnet_ptag_t libnet_autobuild_arp (u_int16_t op, u_int8_t * sha, u_int8_t * spa, u_int8_t * tha, u_int8_t * tpa, libnet_t * l)"
.PP
Autouilds an Address Resolution Protocol (ARP) header. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets. 
.PP
\fBParameters:\fP
.RS 4
\fIop\fP ARP operation type 
.br
\fIsha\fP sender's hardware address 
.br
\fIspa\fP sender's protocol address 
.br
\fItha\fP target hardware address 
.br
\fItpa\fP targer protocol address 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_autobuild_ethernet (u_int8_t * dst, u_int16_t type, libnet_t * l)"
.PP
Autobuilds an Ethernet header. The RFC 894 Ethernet II header is almost identical to the IEEE 802.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length). You should only use this function when libnet is initialized with the LIBNET_LINK interface. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP destination ethernet address 
.br
\fItype\fP upper layer protocol type 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_autobuild_fddi (u_int8_t fc, u_int8_t * dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * org, u_int16_t type, libnet_t * l)"
.PP
Autobuilds a Fiber Distributed Data Interface (FDDI) header. 
.PP
\fBParameters:\fP
.RS 4
\fIfc\fP class format and priority  dst destination fddi address 
.br
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcf\fP cf 
.br
\fIorg\fP IEEE organizational code 
.br
\fItype\fP upper layer protocol 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_autobuild_ipv4 (u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t * l)"
.PP
Autobuilds a version 4 Internet Protocol (IP) header. The function is useful * to build an IP header quickly when you do not need a granular level of control. The function takes the same len, prot, and dst arguments as \fBlibnet_build_ipv4()\fP. The function does not accept a ptag argument, but it does return a ptag. In other words, you can use it to build a new IP header but not to modify an existing one. 
.PP
\fBParameters:\fP
.RS 4
\fIlen\fP total length of the IP packet including all subsequent data 
.br
\fIprot\fP upper layer protocol 
.br
\fIdst\fP destination IPv4 address (little endian) 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_autobuild_ipv6 (u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst, libnet_t * l)"
.PP
This function is not yet implement and is a NONOP. 
.PP
\fBParameters:\fP
.RS 4
\fIlen\fP length 
.br
\fInh\fP next header 
.br
\fIdst\fP destination IPv6 address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_autobuild_link (u_int8_t * dst, u_int8_t * oui, u_int16_t type, libnet_t * l)"
.PP
Automatically builds a link layer header for an initialized l. The function determines the proper link layer header format from how l was initialized. The function current supports Ethernet and Token Ring link layers. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP the destination MAC address 
.br
\fIoui\fP Organizationally Unique Identifier (unused for Ethernet) 
.br
\fItype\fP the upper layer protocol type 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_autobuild_token_ring (u_int8_t ac, u_int8_t fc, u_int8_t * dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * org, u_int16_t type, libnet_t * l)"
.PP
Auto-builds a token ring header. 
.PP
\fBParameters:\fP
.RS 4
\fIac\fP access control 
.br
\fIfc\fP frame control 
.br
\fIdst\fP destination address 
.br
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcf\fP control field 
.br
\fIoui\fP Organizationally Unique Identifier 
.br
\fItype\fP upper layer protocol type 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_802_1q (u_int8_t * dst, u_int8_t * src, u_int16_t tpi, u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IEEE 802.1q VLAN tagging header. Depending on the value of len_proto, the function wraps the 802.1q header inside either an IEEE 802.3 header or an RFC 894 Ethernet II (DIX) header (both resulting in an 18-byte frame). If len is 1500 or less, most receiving protocol stacks parse the frame as an IEEE 802.3 encapsulated frame. If len is one of the Ethernet type values, most protocol stacks parse the frame as an RFC 894 Ethernet II encapsulated frame. Note the length value is calculated without the 802.1q header of 18 bytes. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP pointer to a six byte source ethernet address 
.br
\fIsrc\fP pointer to a six byte destination ethernet address 
.br
\fItpi\fP tag protocol identifier 
.br
\fIpriority\fP priority 
.br
\fIcfi\fP canonical format indicator 
.br
\fIvlan_id\fP vlan identifier 
.br
\fIlen_proto\fP length (802.3) protocol (Ethernet II) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_802_1x (u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IEEE 802.1x extended authentication protocol header. 
.PP
\fBParameters:\fP
.RS 4
\fIeap_ver\fP the EAP version 
.br
\fIeap_type\fP the EAP type 
.br
\fIlength\fP frame length 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_802_2 (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IEEE 802.2 LLC header. 
.PP
\fBParameters:\fP
.RS 4
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcontrol\fP control field 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_802_2snap (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t * oui, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IEEE 802.2 LLC SNAP header. 
.PP
\fBParameters:\fP
.RS 4
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcontrol\fP control field 
.br
\fIoui\fP Organizationally Unique Identifier 
.br
\fItype\fP upper layer protocol 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_802_3 (u_int8_t * dst, u_int8_t * src, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IEEE 802.3 header. The 802.3 header is almost identical to the RFC 894 Ethernet II header, the exception being that the field immediately following the source address holds the frame's length (as opposed to the layer 3 protocol). You should only use this function when libnet is initialized with the LIBNET_LINK interface. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP destination ethernet address 
.br
\fIsrc\fP source ethernet address 
.br
\fIlen\fP frame length sans header 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_arp (u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, u_int16_t op, u_int8_t * sha, u_int8_t * spa, u_int8_t * tha, u_int8_t * tpa, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an Address Resolution Protocol (ARP) header. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets. 
.PP
\fBParameters:\fP
.RS 4
\fIhrd\fP hardware address format 
.br
\fIpro\fP protocol address format 
.br
\fIhln\fP hardware address length 
.br
\fIpln\fP protocol address length 
.br
\fIop\fP ARP operation type 
.br
\fIsha\fP sender's hardware address 
.br
\fIspa\fP sender's protocol address 
.br
\fItha\fP target hardware address 
.br
\fItpa\fP targer protocol address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_bgp4_header (u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], u_int16_t len, u_int8_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) header. The primary function of a BGP speaking system is to exchange network reachability information with other BGP systems. This network reachability information includes information on the list of Autonomous Systems (ASs) that reachability information traverses. This information is sufficient to construct a graph of AS connectivity from which routing loops may be pruned and some policy decisions at the AS level may be enforced. This function builds the base BGP header which is used as a preamble before any other BGP header. For example, a BGP KEEPALIVE message may be built with only this function, while an error notification requires a subsequent call to libnet_build_bgp4_notification. 
.PP
\fBParameters:\fP
.RS 4
\fImarker\fP a value the receiver can predict (if the message type is not BGP OPEN, or no authentication is used, these 16 bytes are normally set as all ones) 
.br
\fIlen\fP total length of the BGP message, including the header 
.br
\fItype\fP type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_bgp4_notification (u_int8_t err_code, u_int8_t err_subcode, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) notification header. A NOTIFICATION message is sent when an error condition is detected. Specific error information may be passed through the payload interface. 
.PP
\fBParameters:\fP
.RS 4
\fIerr_code\fP type of notification 
.br
\fIerr_subcode\fP more specific information about the reported error. 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_bgp4_open (u_int8_t version, u_int16_t src_as, u_int16_t hold_time, u_int32_t bgp_id, u_int8_t opt_len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) OPEN header. This is the first message sent by each side of a BGP connection. The optional parameters options should be constructed using the payload interface (see RFC 1771 for the options structures). 
.PP
\fBParameters:\fP
.RS 4
\fIversion\fP protocol version (should be set to 4) 
.br
\fIsrc_as\fP Autonomous System of the sender 
.br
\fIhold_time\fP used to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender 
.br
\fIbgp_id\fP BGP identifier of the sender 
.br
\fIopt_len\fP total length of the optional parameters field in bytes 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_bgp4_update (u_int16_t unfeasible_rt_len, u_int8_t * withdrawn_rt, u_int16_t total_path_attr_len, u_int8_t * path_attributes, u_int16_t info_len, u_int8_t * reachability_info, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header. Update messages are used to transfer routing information between BGP peers. 
.PP
\fBParameters:\fP
.RS 4
\fIunfeasible_rt_len\fP indicates the length of the (next) 'withdrawn routes' field in bytes 
.br
\fIwithdrawn_rt\fP list of IP addresses prefixes for the routes that are being withdrawn; each IP address prefix is built as a 2-tuple <length (1 byte), prefix (variable)> 
.br
\fItotal_path_attr_len\fP indicates the length of the (next) 'path attributes' field in bytes 
.br
\fIpath_attributes\fP each attribute is a 3-tuple <type (2 bytes), length, value> 
.br
\fIinfo_len\fP indicates the length of the (next) 'network layer reachability information' field in bytes (needed for internal memory size calculation) 
.br
\fIreachability_info\fP 2-tuples <length (1 byte), prefix (variable)>. 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_bootpv4 (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t * chaddr, u_int8_t * sname, u_int8_t * file, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_cdp (u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, u_int16_t len, u_int8_t * value, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a Cisco Discovery Protocol (CDP) header. Cisco Systems designed CDP to aid in the network management of adjacent Cisco devices. The CDP protocol specifies data by using a type/length/value (TLV) setup. The first TLV can specified by using the functions type, length, and value arguments. To specify additional TLVs, the programmer could either use the payload interface or \fBlibnet_build_data()\fP to construct them. 
.PP
\fBParameters:\fP
.RS 4
\fIversion\fP CDP version 
.br
\fIttl\fP time to live (time information should be cached by recipient) 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fItype\fP type of data contained in value 
.br
\fIlen\fP length of value arugment 
.br
\fIvalue\fP the CDP information string 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_data (u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a generic libnet protocol header. This is useful for including an optional payload to a packet that might need to change repeatedly inside of a loop. 
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_dhcpv4 (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t * chaddr, u_int8_t * sname, u_int8_t * file, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_dnsv4 (u_int16_t h_len, u_int16_t id, u_int16_t flags, u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, u_int16_t num_addi_rr, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 1035 version 4 DNS header. Additional DNS payload information should be specified using the payload interface. 
.PP
\fBParameters:\fP
.RS 4
\fIid\fP DNS packet id 
.br
\fIflags\fP control flags 
.br
\fInum_q\fP number of questions 
.br
\fInum_anws_rr\fP number of answer resource records 
.br
\fInum_auth_rr\fP number of authority resource records 
.br
\fInum_addi_rr\fP number of additional resource records 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_egre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as 'delivery header'. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header. 
.PP
\fBParameters:\fP
.RS 4
\fIfv\fP the 16 0 to 7: which fields are included in the header (checksum, seq. number, key, ...), bits 8 to 12: flag, bits 13 to 15: version. 
.br
\fIpayload\fP optional payload or NULL 
.br
\fItype\fP which protocol is encapsulated (PPP, IP, ...) 
.br
\fIsum\fP checksum (0 for libnet to autofill). 
.br
\fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE 
.br
\fIkey\fP inserted by the encapsulator to authenticate the source 
.br
\fIseq\fP sequence number used by the receiver to sort the packets 
.br
\fIlen\fP size of the GRE packet 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ethernet (u_int8_t * dst, u_int8_t * src, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an Ethernet header. The RFC 894 Ethernet II header is almost identical to the IEEE 802.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length). You should only use this function when libnet is initialized with the LIBNET_LINK interface. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP destination ethernet address 
.br
\fIsrc\fP source ethernet address 
.br
\fItype\fP upper layer protocol type 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_fddi (u_int8_t fc, u_int8_t * dst, u_int8_t * src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * org, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a Fiber Distributed Data Interface (FDDI) header. 
.PP
\fBParameters:\fP
.RS 4
\fIfc\fP class format and priority  dst destination fddi address  src source fddi address 
.br
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcf\fP cf 
.br
\fIorg\fP 3 byte IEEE organizational code 
.br
\fItype\fP upper layer protocol 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_gre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as 'delivery header'. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header. 
.PP
\fBParameters:\fP
.RS 4
\fIfv\fP the 16 0 to 7: which fields are included in the header (checksum, seq. number, key, ...), bits 8 to 12: flag, bits 13 to 15: version. 
.br
\fIpayload\fP optional payload or NULL 
.br
\fItype\fP which protocol is encapsulated (PPP, IP, ...) 
.br
\fIsum\fP checksum (0 for libnet to autofill). 
.br
\fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE 
.br
\fIkey\fP inserted by the encapsulator to authenticate the source 
.br
\fIseq\fP sequence number used by the receiver to sort the packets 
.br
\fIlen\fP size of the GRE packet 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_gre_last_sre (libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_gre_sre (u_int16_t af, u_int8_t offset, u_int8_t length, u_int8_t * routing, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_icmpv4_echo (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) echo request/reply header 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO) 
.br
\fIcode\fP code of ICMP packet (should be 0) 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIid\fP identification number 
.br
\fIseq\fP packet sequence number 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_icmpv4_mask (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) IP netmask request/reply header. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY) 
.br
\fIcode\fP code of ICMP packet (should be 0) 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIid\fP identification number 
.br
\fIseq\fP packet sequence number 
.br
\fImask\fP subnet mask 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_icmpv4_redirect (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t gateway, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IP version 4 RFC 792 Internet Message Control Protocol (ICMP) redirect header. The additional arguments enable the application programmer to easily specify the original IP header values (the IP header of the packet that supposedly caused the ICMP redirect message in the first place). 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_REDIRECT) 
.br
\fIcode\fP code of ICMP packet (should be one of the four redirect codes) 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIorig_id\fP original IP header identification 
.br
\fIorig_frag\fP original IP header fragmentation information 
.br
\fIorig_ttl\fP orginal IP header time to live 
.br
\fIorig_prot\fP original IP header protocol 
.br
\fIorig_check\fP original IP header checksum 
.br
\fIorig_src\fP original IP header source address 
.br
\fIorig_dst\fP original IP header destination address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_icmpv4_timeexceed (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) time exceeded header. The additional arguments enable the application programmer to easily specify the original IPv4 header values (the IP header of the packet that supposedly caused the ICMP time exceeded message in the first place). 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_TIMXCEED) 
.br
\fIcode\fP code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS) 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIorig_id\fP original IP header identification 
.br
\fIorig_frag\fP original IP header fragmentation information 
.br
\fIorig_ttl\fP orginal IP header time to live 
.br
\fIorig_prot\fP original IP header protocol 
.br
\fIorig_check\fP original IP header checksum 
.br
\fIorig_src\fP original IP header source address 
.br
\fIorig_dst\fP original IP header destination address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_icmpv4_timestamp (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) timestamp request/reply header. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY) 
.br
\fIcode\fP code of ICMP packet (should be 0) 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIid\fP identification number 
.br
\fIseq\fP sequence number 
.br
\fIotime\fP originate timestamp 
.br
\fIrtime\fP receive timestamp 
.br
\fIttime\fP transmit timestamp 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_icmpv4_unreach (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) unreachable header. The additional arguments enable the application programmer to easily specify the original IPv4 header values (the IP header of the packet that supposedly caused the ICMP unreachable message in the first place). 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_UNREACH) 
.br
\fIcode\fP code of ICMP packet (should be one of the 16 unreachable codes) 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIorig_id\fP original IP header identification 
.br
\fIorig_frag\fP original IP header fragmentation information 
.br
\fIorig_ttl\fP orginal IP header time to live 
.br
\fIorig_prot\fP original IP header protocol 
.br
\fIorig_check\fP original IP header checksum 
.br
\fIorig_src\fP original IP header source address 
.br
\fIorig_dst\fP original IP header destination address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_igmp (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 1112 Internet Group Memebership Protocol (IGMP) header. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP packet type 
.br
\fIcode\fP packet code (should be 0) 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIip\fP IPv4 address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipsec_ah (u_int8_t nh, u_int8_t len, u_int16_t res, u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an Internet Protocol Security Authentication header. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIlen\fP payload length 
.br
\fIres\fP reserved 
.br
\fIspi\fP security parameter index 
.br
\fIseq\fP sequence number 
.br
\fIauth\fP authentication data 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipsec_esp_ftr (u_int8_t len, u_int8_t nh, int8_t * auth, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an Internet Protocol Security Encapsulating Security Payload footer. 
.PP
\fBParameters:\fP
.RS 4
\fIlen\fP padding length 
.br
\fInh\fP next header 
.br
\fIauth\fP authentication data 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipsec_esp_hdr (u_int32_t spi, u_int32_t seq, u_int32_t iv, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an Internet Protocol Security Encapsulating Security Payload header. 
.PP
\fBParameters:\fP
.RS 4
\fIspi\fP security parameter index 
.br
\fIseq\fP ESP sequence number 
.br
\fIiv\fP initialization vector 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipv4 (u_int16_t len, u_int8_t tos, u_int16_t id, u_int16_t frag, u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a version 4 RFC 791 Internet Protocol (IP) header. 
.PP
\fBParameters:\fP
.RS 4
\fIlen\fP total length of the IP packet including all subsequent data 
.br
\fItos\fP type of service bits 
.br
\fIid\fP IP identification number 
.br
\fIfrag\fP fragmentation bits and offset 
.br
\fIttl\fP time to live in the network 
.br
\fIprot\fP upper layer protocol 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIsrc\fP source IPv4 address (little endian) 
.br
\fIdst\fP destination IPv4 address (little endian) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipv4_options (u_int8_t * options, u_int32_t options_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an version 4 Internet Protocol (IP) options header. The function expects options to be a valid IP options string of size options_s, no larger than 40 bytes (the maximum size of an options string). The function checks to make sure that the preceding header is an IPv4 header and that the options string would not result in a packet larger than 65,535 bytes (IPMAXPACKET). The function counts up the number of 32-bit words in the options string and adjusts the IP header length value as necessary. 
.PP
\fBParameters:\fP
.RS 4
\fIoptions\fP byte string of IP options 
.br
\fIoptions_s\fP length of options string 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipv6 (u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a version 6 RFC 2460 Internet Protocol (IP) header. 
.PP
\fBParameters:\fP
.RS 4
\fItc\fP traffic class 
.br
\fIfl\fP flow label 
.br
\fIlen\fP total length of the IP packet 
.br
\fInh\fP next header 
.br
\fIhl\fP hop limit 
.br
\fIsrc\fP source IPv6 address 
.br
\fIdst\fP destination IPv6 address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipv6_destopts (u_int8_t nh, u_int8_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a version 6 RFC 2460 Internet Protocol (IP) destination options header. This function is special in that it uses the payload interface to include the options data. The application programmer will build an IPv6 options byte string and pass it to the function using the payload interface. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIlen\fP length of the header in 8-byte octets not including the first 8 octets 
.br
\fIpayload\fP options payload 
.br
\fIpayload_s\fP payload length 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipv6_frag (u_int8_t nh, u_int8_t reserved, u_int16_t frag, u_int32_t id, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIreserved\fP unused value... OR IS IT! 
.br
\fIfrag\fP fragmentation bits (ala ipv4) 
.br
\fIid\fP packet identification 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipv6_hbhopts (u_int8_t nh, u_int8_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a version 6 RFC 2460 Internet Protocol (IP) hop by hop options header. This function is special in that it uses the payload interface to include the options data. The application programmer will build an IPv6 hop by hop options byte string and pass it to the function using the payload interface. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIlen\fP length of the header in 8-byte octets not including the first 8 octets 
.br
\fIpayload\fP options payload 
.br
\fIpayload_s\fP payload length 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ipv6_routing (u_int8_t nh, u_int8_t len, u_int8_t rtype, u_int8_t segments, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a version 6 RFC 2460 Internet Protocol (IP) routing header. This function is special in that it uses the payload interface to include the 'type-specific data'; that is the routing information. Most often this will be a number of 128-bit IPv6 addresses. The application programmer will build a byte string of IPv6 address and pass them to the function using the payload interface. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIlen\fP length of the header in 8-byte octets not including the first 8 octets  routing header type 
.br
\fIsegments\fP number of routing segments that follow 
.br
\fIpayload\fP optional payload of routing information 
.br
\fIpayload_s\fP payload length 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_isl (u_int8_t * dhost, u_int8_t type, u_int8_t user, u_int8_t * shost, u_int16_t len, u_int8_t * snap, u_int16_t vid, u_int16_t index, u_int16_t reserved, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a Cisco Inter-Switch Link (ISL) header. 
.PP
\fBParameters:\fP
.RS 4
\fIdhost\fP destination address (should be 01:00:0c:00:00) 
.br
\fItype\fP type of frame 
.br
\fIuser\fP user defined data 
.br
\fIshost\fP source mac address 
.br
\fIlen\fP total length of the encapuslated packet less 18 bytes 
.br
\fIsnap\fP SNAP information (0xaaaa03 + vendor code) 
.br
\fIvid\fP 15 bit VLAN ID, 1 bit BPDU or CDP indicator 
.br
\fIindex\fP port index 
.br
\fIreserved\fP used for FDDI and token ring 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_link (u_int8_t * dst, u_int8_t * src, u_int8_t * oui, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a link layer header for an initialized l. The function determines the proper link layer header format from how l was initialized. The function current supports Ethernet and Token Ring link layers. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP the destination MAC address 
.br
\fIsrc\fP the source MAC address 
.br
\fIoui\fP Organizationally Unique Identifier (unused for Ethernet) 
.br
\fItype\fP the upper layer protocol type 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_mpls (u_int32_t label, u_int8_t experimental, u_int8_t bos, u_int8_t ttl, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header. 
.PP
\fBParameters:\fP
.RS 4
\fIlabel\fP 20-bit label value 
.br
\fIexperimental\fP 3-bit reserved field 
.br
\fIbos\fP 1-bit bottom of stack identifier 
.br
\fIttl\fP time to live 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ntp (u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 958 Network Time Protocol (NTP) header. 
.PP
\fBParameters:\fP
.RS 4
\fIleap_indicator\fP the leap indicator 
.br
\fIversion\fP NTP protocol version 
.br
\fImode\fP NTP mode 
.br
\fIstratum\fP stratum 
.br
\fIpoll\fP polling interval 
.br
\fIprecision\fP precision 
.br
\fIdelay_interval\fP delay interval 
.br
\fIdelay_frac\fP delay fraction 
.br
\fIdispersion_int\fP dispersion interval 
.br
\fIdispersion_frac\fP dispersion fraction 
.br
\fIreference_id\fP reference id 
.br
\fIref_ts_int\fP reference timestamp integer 
.br
\fIref_ts_frac\fP reference timestamp fraction 
.br
\fIorig_ts_int\fP original timestamp integer 
.br
\fIorig_ts_frac\fP original timestamp fraction 
.br
\fIrec_ts_int\fP receiver timestamp integer 
.br
\fIrec_ts_frac\fP reciever timestamp fraction 
.br
\fIxmt_ts_int\fP transmit timestamp integer 
.br
\fIxmt_ts_frac\fP transmit timestamp integer 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2 (u_int16_t len, u_int8_t type, u_int32_t rtr_id, u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_dbd (u_int16_t dgram_len, u_int8_t opts, u_int8_t type, u_int seqnum, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_hello (u_int32_t netmask, u_int16_t interval, u_int8_t opts, u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, u_int32_t neighbor, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_lsa (u_int16_t age, u_int8_t opts, u_int8_t type, u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_lsa_as (u_int32_t nmask, u_int metric, u_int32_t fwdaddr, u_int tag, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_lsa_net (u_int32_t nmask, u_int rtrid, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_lsa_rtr (u_int16_t flags, u_int16_t num, u_int id, u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_lsa_sum (u_int32_t nmask, u_int metric, u_int tos, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_lsr (u_int type, u_int lsid, u_int32_t advrtr, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_lsu (u_int num, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_rip (u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, u_int32_t metric, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a Routing Information Protocol header (RFCs 1058 and 2453). 
.PP
\fBParameters:\fP
.RS 4
\fIcmd\fP command 
.br
\fIversion\fP protocol version 
.br
\fIrd\fP version one: 0, version two: routing domain 
.br
\fIaf\fP address family 
.br
\fIrt\fP version one: 0, version two: route tag 
.br
\fIaddr\fP IPv4 address 
.br
\fImask\fP version one: 0, version two: subnet mask 
.br
\fInext_hop\fP version one: 0, version two: next hop address 
.br
\fImetric\fP routing metric 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_rpc_call (u_int32_t rm, u_int32_t xid, u_int32_t prog_num, u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, u_int8_t * cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t * vdata, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an Remote Procedure Call (Version 2) Call message header as specified in RFC 1831. This builder provides the option for specifying the record marking which is required when used with streaming protocols (TCP). 
.PP
\fBParameters:\fP
.RS 4
\fIrm\fP record marking indicating the position in a stream, 0 otherwise 
.br
\fIxid\fP transaction identifier used to link calls and replies 
.br
\fIprog_num\fP remote program specification typically between 0 - 1fffffff 
.br
\fIprog_vers\fP remote program version specification 
.br
\fIprocedure\fP procedure to be performed by remote program 
.br
\fIcflavor\fP authentication credential type 
.br
\fIclength\fP credential length (should be 0) 
.br
\fIcdata\fP opaque credential data (currently unused) 
.br
\fIvflavor\fP authentication verifier type 
.br
\fIvlength\fP verifier length (should be 0) 
.br
\fIvdata\fP opaque verifier data (currently unused) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_sebek (u_int32_t magic, u_int16_t version, u_int16_t type, u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a Sebek header. The Sebek protocol was designed by the Honeynet Project as a transport mechanism for post-intrusion forensic data. More information may be found here: http://www.honeynet.org/papers/sebek.pdf.
.PP
\fBParameters:\fP
.RS 4
\fImagic\fP identify packets that should be hidden 
.br
\fIversion\fP protocol version, currently 1 
.br
\fItype\fP type of record (read data is type 0, write data is type 1) 
.br
\fIcounter\fP PDU counter used to identify when packet are lost 
.br
\fItime_sec\fP seconds since EPOCH according to the honeypot 
.br
\fItime_usec\fP residual microseconds 
.br
\fIpid\fP PID 
.br
\fIuid\fP UID 
.br
\fIfd\fP FD 
.br
\fIcmd[SEBEK_CMD_LENGTH]\fP 12 first characters of the command 
.br
\fIlength\fP length in bytes of the PDU's body 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_stp_conf (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t flags, u_int8_t * root_id, u_int32_t root_pc, u_int8_t * bridge_id, u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, u_int16_t hello_time, u_int16_t f_delay, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IEEE 802.1d Spanning Tree Protocol (STP) configuration header. STP frames are usually encapsulated inside of an 802.2 + 802.3 frame combination. 
.PP
\fBParameters:\fP
.RS 4
\fIid\fP protocol id 
.br
\fIversion\fP protocol version 
.br
\fIbpdu_type\fP bridge protocol data unit type 
.br
\fIflags\fP flags 
.br
\fIroot_id\fP root id 
.br
\fIroot_pc\fP root path cost 
.br
\fIbridge_id\fP bridge id 
.br
\fIport_id\fP port id 
.br
\fImessage_age\fP message age 
.br
\fImax_age\fP max age 
.br
\fIhello_time\fP hello time 
.br
\fIf_delay\fP forward delay 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_stp_tcn (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an IEEE 802.1d Spanning Tree Protocol (STP) topology change notification header. STP frames are usually encapsulated inside of an 802.2 + 802.3 frame combination. 
.PP
\fBParameters:\fP
.RS 4
\fIid\fP protocol id 
.br
\fIversion\fP protocol version 
.br
\fIbpdu_type\fP bridge protocol data unit type 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_tcp (u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 793 Transmission Control Protocol (TCP) header. 
.PP
\fBParameters:\fP
.RS 4
\fIsp\fP source port 
.br
\fIdp\fP destination port 
.br
\fIseq\fP sequence number 
.br
\fIack\fP acknowledgement number 
.br
\fIcontrol\fP control flags 
.br
\fIwin\fP window size 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIurg\fP urgent pointer  len total length of the TCP packet (for checksum calculation) 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_tcp_options (u_int8_t * options, u_int32_t options_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 793 Transmission Control Protocol (TCP) options header. The function expects options to be a valid TCP options string of size options_s, which is no larger than 40 bytes (the maximum size of an options string). The function checks to ensure that the packet consists of a TCP header preceded by an IPv4 header, and that the addition of the options string would not result in a packet larger than 65,535 bytes (IPMAXPACKET). The function counts up the number of 32-bit words in the options string and adjusts the TCP header length value as necessary. 
.PP
\fBParameters:\fP
.RS 4
\fIoptions\fP byte string of TCP options 
.br
\fIoptions_s\fP length of options string 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_token_ring (u_int8_t ac, u_int8_t fc, u_int8_t * dst, u_int8_t * src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t * org, u_int16_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds a token ring header. 
.PP
\fBParameters:\fP
.RS 4
\fIac\fP access control 
.br
\fIfc\fP frame control 
.br
\fIdst\fP destination address 
.br
\fIsrc\fP source address 
.br
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcf\fP control field 
.br
\fIoui\fP Organizationally Unique Identifier 
.br
\fItype\fP upper layer protocol type 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_udp (u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 768 User Datagram Protocol (UDP) header. 
.PP
\fBParameters:\fP
.RS 4
\fIsp\fP source port 
.br
\fIdp\fP destination port 
.br
\fIlen\fP total length of the UDP packet 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_vrrp (u_int8_t version, u_int8_t type, u_int8_t vrouter_id, u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, u_int16_t sum, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
.PP
Builds an RFC 2338 Virtual Router Redundacy Protool (VRRP) header. Use the payload interface to specify address and autthentication information. To build a 'legal' packet, the destination IPv4 address should be the multicast * address 224.0.0.18, the IP TTL should be set to 255, and the IP protocol should be set to 112. 
.PP
\fBParameters:\fP
.RS 4
\fIversion\fP VRRP version (should be 2) 
.br
\fItype\fP VRRP packet type (should be 1 -- ADVERTISEMENT) 
.br
\fIvrouter_id\fP virtual router identification 
.br
\fIpriority\fP priority (higher numbers indicate higher priority) 
.br
\fIip_count\fP number of IPv4 addresses contained in this advertisement 
.br
\fIauth_type\fP type of authentication (0, 1, 2 -- see RFC) 
.br
\fIadvert_int\fP interval between advertisements 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "void libnet_clear_packet (libnet_t * l)"
.PP
Clears the current packet referenced and frees all pblocks. Should be called when the programmer want to send a completely new packet of a different type using the same context. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP

.SS "int libnet_cq_add (libnet_t * l, char * label)"
.PP
[Context Queue] Adds a new context to the libnet context queue. If no queue exists, this function will create the queue and add the specified libnet context as the first entry on the list. The functions checks to ensure niether l nor label are NULL, and that label doesn't refer to an existing context already in the queue. Additionally, l should refer to a libnet context previously initialized with a call to \fBlibnet_init()\fP. If the context queue in write locked, this function will fail. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIlabel\fP a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, -1 on failure 
.RE
.PP

.SS "void libnet_cq_destroy ()"
.PP
[Context Queue] Destroys the entire context queue, calling \fBlibnet_destroy()\fP on each member context. 
.SS "libnet_t* libnet_cq_find_by_label (char * label)"
.PP
[Context Queue] Locates a libnet context from the queue, indexed by a canonical label. 
.PP
\fBParameters:\fP
.RS 4
\fIlabel\fP canonical label of the libnet context to retrieve 
.RE
.PP
\fBReturns:\fP
.RS 4
the expected libnet context, NULL on failure 
.RE
.PP

.SS "int8_t* libnet_cq_getlabel (libnet_t * l)"
.PP
[Context Queue] Returns the canonical label associated with the context. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
pointer to the libnet context's label 
.RE
.PP

.SS "libnet_t* libnet_cq_head ()"
.PP
[Context Queue] Intiailizes the interator interface and set a write lock on the entire queue. This function is intended to be called just prior to interating through the entire list of contexts (with the probable intent of inject a series of packets in rapid succession). This function is often used as per the following:
.PP
for (l = \fBlibnet_cq_head()\fP; \fBlibnet_cq_last()\fP; l = \fBlibnet_cq_next()\fP) { ... }
.PP
Much of the time, the application programmer will use the iterator as it is written above; as such, libnet provides a macro to do exactly that, \fBfor_each_context_in_cq(l)\fP. Warning: do not call the iterator more than once in a single loop. 
.PP
\fBReturns:\fP
.RS 4
the head of the context queue 
.RE
.PP

.SS "int libnet_cq_last ()"
.PP
[Context Queue] Check whether the iterator is at the last context in the queue. 
.PP
\fBReturns:\fP
.RS 4
1 if at the end of the context queue, 0 otherwise 
.RE
.PP

.SS "libnet_t* libnet_cq_next ()"
.PP
[Context Queue] Get next context from the context queue.  the next context from the context queue 
.SS "libnet_t* libnet_cq_remove (libnet_t * l)"
.PP
[Context Queue] Removes a specified context from the libnet context queue by specifying the libnet context pointer. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to \fBlibnet_destroy()\fP. Also, as it is not necessary to keep the libnet context pointer when initially adding it to the context queue, most application programmers will prefer to refer to entries on the context queue by canonical name and would use \fBlibnet_cq_remove_by_label()\fP. If the context queue is write locked, this function will fail. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the pointer to the removed libnet context, NULL on failure 
.RE
.PP

.SS "libnet_t* libnet_cq_remove_by_label (char * label)"
.PP
[Context Queue] Removes a specified context from the libnet context queue by specifying the canonical name. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to \fBlibnet_destroy()\fP. If the context queue is write locked, this function will fail. 
.PP
\fBParameters:\fP
.RS 4
\fIlabel\fP canonical name of the context to remove 
.RE
.PP
\fBReturns:\fP
.RS 4
the pointer to the removed libnet context, NULL on failure 
.RE
.PP

.SS "u_int32_t libnet_cq_size ()"
.PP
[Context Queue] Function returns the number of libnet contexts that are in the queue. 
.PP
\fBReturns:\fP
.RS 4
the number of libnet contexts currently in the queue 
.RE
.PP

.SS "void libnet_destroy (libnet_t * l)"
.PP
Shuts down the libnet session referenced by l. It closes the network interface and frees all internal memory structures associated with l. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP

.SS "void libnet_diag_dump_context (libnet_t * l)"
.PP
[Diagnostic] Prints the contents of the given context. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP

.SS "void libnet_diag_dump_hex (u_int8_t * packet, u_int32_t len, int swap, FILE * stream)"
.PP
[Diagnostic] Function prints the contents of the supplied buffer to the supplied stream pointer. Will swap endianness based disposition of mode variable. Useful to be used in conjunction with the advanced interface and a culled packet. 
.PP
\fBParameters:\fP
.RS 4
\fIpacket\fP the packet to print 
.br
\fIlen\fP length of the packet in bytes 
.br
\fIswap\fP 1 to swap byte order, 0 to not 
.br
\fIstream\fP a stream pointer to print to 
.RE
.PP

.SS "void libnet_diag_dump_pblock (libnet_t * l)"
.PP
[Diagnostic] Prints the contents of every pblock. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP

.SS "char* libnet_diag_dump_pblock_type (u_int8_t type)"
.PP
[Diagnostic] Returns the canonical name of the pblock type. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP pblock type 
.RE
.PP
\fBReturns:\fP
.RS 4
a string representing the pblock type type or 'unknown' for an unknown value 
.RE
.PP

.SS "struct libnet_ether_addr* libnet_get_hwaddr (libnet_t * l)"
.PP
Returns the MAC address for the device libnet was initialized with. If libnet was initialized without a device the function will attempt to find one. If the function fails and returns NULL a call to \fBlibnet_geterror()\fP will tell you why. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to the MAC address or NULL 
.RE
.PP

.SS "u_int32_t libnet_get_ipaddr4 (libnet_t * l)"
.PP
Returns the IP address for the device libnet was initialized with. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one. If the function fails and returns -1 a call to libnet_geterrror() will tell you why. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
a big endian IP address suitable for use in a libnet_build function or -1 
.RE
.PP

.SS "struct libnet_in6_addr libnet_get_ipaddr6 (libnet_t * l)"
.PP
This function is not yet implemented under IPv6. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
well, nothing yet 
.RE
.PP

.SS "u_int32_t libnet_get_prand (int mod)"
.PP
Generates an unsigned psuedo-random value within the range specified by mod. LIBNET_PR2 0 - 1 LIBNET_PR8 0 - 255 LIBNET_PR16 0 - 32767 LIBNET_PRu16 0 - 65535 LIBNET_PR32 0 - 2147483647 LIBNET_PRu32 0 - 4294967295
.PP
\fBParameters:\fP
.RS 4
\fImod\fP one the of LIBNET_PR* constants 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, -1 on failure 
.RE
.PP

.SS "int8_t* libnet_getdevice (libnet_t * l)"
.PP
Returns the canonical name of the device used for packet injection. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the canonical name of the device used for packet injection. Note it can be NULL without being an error. 
.RE
.PP

.SS "char* libnet_geterror (libnet_t * l)"
.PP
Returns the last error set inside of the referenced libnet context. This function should be called anytime a function fails or an error condition is detected inside of libnet. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
an error string or NULL if no error has occured 
.RE
.PP

.SS "int libnet_getfd (libnet_t * l)"
.PP
Returns the FILENO of the file descriptor used for packet injection. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the file number of the file descriptor used for packet injection 
.RE
.PP

.SS "u_int32_t libnet_getgre_length (u_int16_t fv)\fC [inline]\fP"
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success, -1 on error 
.RE
.PP

.SS "u_int32_t libnet_getpacket_size (libnet_t * l)"
.PP
Returns the sum of the size of all of the pblocks inside of l (this should be the resuling packet size). 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the size of the packet in l 
.RE
.PP

.SS "u_int8_t* libnet_getpbuf (libnet_t * l, libnet_ptag_t ptag)"
.PP
Returns the pblock buffer contents for the specified ptag; a subsequent call to \fBlibnet_getpbuf_size()\fP should be made to determine the size of the buffer. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP the ptag reference number 
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to the pblock buffer or NULL on error 
.RE
.PP

.SS "u_int32_t libnet_getpbuf_size (libnet_t * l, libnet_ptag_t ptag)"
.PP
Returns the pblock buffer size for the specified ptag; a previous call to \fBlibnet_getpbuf()\fP should be made to pull the actual buffer contents. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP the ptag reference number 
.RE
.PP
\fBReturns:\fP
.RS 4
the size of the pblock buffer 
.RE
.PP

.SS "u_int8_t* libnet_hex_aton (int8_t * s, int * len)"
.PP
Takes a colon separated hexidecimal address (from the command line) and returns a bytestring suitable for use in a libnet_build function. Note this function performs an implicit malloc and the return value should be freed after its use. 
.PP
\fBParameters:\fP
.RS 4
\fIs\fP the string to be parsed 
.br
\fIlen\fP the resulting size of the returned byte string 
.RE
.PP
\fBReturns:\fP
.RS 4
a byte string or NULL on failure 
.RE
.PP

.SS "libnet_t* libnet_init (int injection_type, char * device, char * err_buf)"
.PP
Creates the libnet environment. It initializes the library and returns a libnet context. If the injection_type is LIBNET_LINK or LIBNET_LINK_ADV, the function initializes the injection primitives for the link-layer interface enabling the application programmer to build packets starting at the data-link layer (which also provides more granular control over the IP layer). If libnet uses the link-layer and the device argument is non-NULL, the function attempts to use the specified network device for packet injection. This is either a canonical string that references the device (such as 'eth0' for a 100MB Ethernet card on Linux or 'fxp0' for a 100MB Ethernet card on OpenBSD) or the dots and decimals representation of the device's IP address (192.168.0.1). If device is NULL, libnet attempts to find a suitable device to use. If the injection_type is LIBNET_RAW4 or LIBNET_RAW4_ADV, the function initializes the injection primitives for the IPv4 raw socket interface. The final argument, err_buf, should be a buffer of size LIBNET_ERRBUF_SIZE and holds an error message if the function fails. This function requires root privileges to execute successfully. Upon success, the function returns a valid libnet context for use in later function calls; upon failure, the function returns NULL. 
.PP
\fBParameters:\fP
.RS 4
\fIinjection_type\fP packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV) 
.br
\fIdevice\fP the interface to use (NULL and libnet will choose one) 
.br
\fIerr_buf\fP will contain an error message on failure 
.RE
.PP
\fBReturns:\fP
.RS 4
libnet context ready for use or NULL on error. 
.RE
.PP

.SS "u_int32_t libnet_name2addr4 (libnet_t * l, char * host_name, u_int8_t use_name)"
.PP
Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv4 address. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIhost_name\fP pointer to a string containing a presentation format host name 
.br
\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE 
.RE
.PP
\fBReturns:\fP
.RS 4
network byte ordered IPv4 address or -1 (2^32 - 1) on error 
.RE
.PP

.SS "struct libnet_in6_addr libnet_name2addr6 (libnet_t * l, char * host_name, u_int8_t use_name)"
.PP
Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv6 address. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIhost_name\fP pointer to a string containing a presentation format host name 
.br
\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE 
.RE
.PP
\fBReturns:\fP
.RS 4
network byte ordered IPv6 address structure 
.RE
.PP

.SS "int libnet_plist_chain_dump (libnet_plist_t * plist)"
.PP
Runs through the port list and prints the contents of the port list chain list to stdout. 
.PP
\fBParameters:\fP
.RS 4
\fIplist\fP previously created portlist 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, -1 on failure 
.RE
.PP

.SS "char* libnet_plist_chain_dump_string (libnet_plist_t * plist)"
.PP
Runs through the port list and prints the contents of the port list chain list to string. This function uses strdup and is not re-entrant. It also has a memory leak and should not really be used. 
.PP
\fBParameters:\fP
.RS 4
\fIplist\fP previously created portlist 
.RE
.PP
\fBReturns:\fP
.RS 4
a printable string containing the port list contents on success NULL on error 
.RE
.PP

.SS "int libnet_plist_chain_free (libnet_plist_t * plist)"
.PP
Frees all memory associated with port list chain. 
.PP
\fBParameters:\fP
.RS 4
\fIplist\fP previously created portlist 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, -1 on failure 
.RE
.PP

.SS "int libnet_plist_chain_new (libnet_t * l, libnet_plist_t ** plist, char * token_list)"
.PP
Creates a new port list. Port list chains are useful for TCP and UDP-based applications that need to send packets to a range of ports (contiguous or otherwise). The port list chain, which token_list points to, should contain a series of int8_tacters from the following list: '0123456789,-' of the general format 'x - y, z', where 'xyz' are port numbers between 0 and 65,535. plist points to the front of the port list chain list for use in further libnet_plist_chain() functions. Upon success, the function returns 1. Upon failure, the function returns -1 and \fBlibnet_geterror()\fP can tell you why. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIplist\fP if successful, will refer to the portlist, if not, NULL 
.br
\fItoken_list\fP string containing the port list primitive 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, -1 on failure 
.RE
.PP

.SS "int libnet_plist_chain_next_pair (libnet_plist_t * plist, u_int16_t * bport, u_int16_t * eport)"
.PP
Returns the next port list chain pair from the port list chain plist. bport and eport contain the starting port number and ending port number, respectively. Upon success, the function returns 1 and fills in the port variables; however, if the list is empty, the function returns 0 and sets both port variables to 0. Upon failure, the function returns -1. 
.PP
\fBParameters:\fP
.RS 4
\fIplist\fP previously created portlist 
.br
\fIbport\fP will contain the beginning port number or 0 
.br
\fIeport\fP will contain the ending port number or 0 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, 0 if empty, -1 on failure 
.RE
.PP

.SS "int libnet_seed_prand (libnet_t * l)"
.PP
Seeds the psuedo-random number generator. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, -1 on failure 
.RE
.PP

.SS "void libnet_stats (libnet_t * l, struct libnet_stats * ls)"
.PP
Fills in a libnet_stats structure with packet injection statistics (packets written, bytes written, packet sending errors). 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIls\fP pointer to a libnet statistics structure 
.RE
.PP

.SS "int libnet_toggle_checksum (libnet_t * l, libnet_ptag_t ptag, int mode)"
.PP
If a given protocol header is built with the checksum field set to '0', by default libnet will calculate the header checksum prior to injection. If the header is set to any other value, by default libnet will not calculate the header checksum. To over-ride this behavior, use \fBlibnet_toggle_checksum()\fP. Switches auto-checksumming on or off for the specified ptag. If mode is set to LIBNET_ON, libnet will mark the specificed ptag to calculate a checksum for the ptag prior to injection. This assumes that the ptag refers to a protocol that has a checksum field. If mode is set to LIBNET_OFF, libnet will clear the checksum flag and no checksum will be computed prior to injection. This assumes that the programmer will assign a value (zero or otherwise) to the checksum field. Often times this is useful if a precomputed checksum or some other predefined value is going to be used. Note that when libnet is initialized with LIBNET_RAW4, the IPv4 header checksum will always be computed by the kernel prior to injection, regardless of what the programmer sets. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP the ptag reference number 
.br
\fImode\fP LIBNET_ON or LIBNET_OFF 
.RE
.PP
\fBReturns:\fP
.RS 4
1 on success, -1 on failure 
.RE
.PP

.SS "int libnet_write (libnet_t * l)"
.PP
Writes a prebuilt packet to the network. The function assumes that l was previously initialized (via a call to \fBlibnet_init()\fP) and that a previously constructed packet has been built inside this context (via one or more calls to the libnet_build* family of functions) and is ready to go. Depending on how libnet was initialized, the function will write the packet to the wire either via the raw or link layer interface. The function will also bump up the internal libnet stat counters which are retrievable via \fBlibnet_stats()\fP. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the number of bytes written, -1 on error 
.RE
.PP

.SH "Author"
.PP 
Generated automatically by Doxygen for libnet from the source code.
